<template>
  <div class="auctionbody">
    <div class="auction_item" v-for="(item, i) in info.banner" :key="i">
      <div class="auction_item_left">
        <img :src="$fnc.getImgUrl(item.piclink)" alt="" />
      </div>
      <div class="auction_item_right">
        <p>{{ item.title }}</p>
        <div class="auction_item_right_middle">
          <div>
            <!-- <p>当前价：<span>￥ <small>{{info.auction_price || 'xx'}}</small></span></p> -->
            <p>
              当前价：
              <span class="price_regular">
                <small>￥</small>
                <b>{{ get_int_dec(item.auction_price || 0, "int") }}</b>
                <i>{{ get_int_dec(item.auction_price || 0, "dec") }}</i>
              </span>
            </p>
            <p>
              {{ item.auction_number }}次出价
              <span>|</span>
              起拍价:{{ $fnc.toFixedZ(item.starting_price, 0) }}
            </p>
          </div>
          <span>去竞拍</span>
        </div>
        <div class="auction_item_right_bottom">
          <span>{{ item.auction_title }}</span>
          <!-- <van-count-down :time="item.auction_countdown * 1000" format="剩HH时mm分ss秒" /> -->
          <span>剩HH时mm分ss秒</span>
        </div>
      </div>
    </div>
    <!-- <div class="assemble-item">
      <div class="assemble-shop-item fx" v-for="(item, i) in info.banner" :key="i">
        <img :src="$fnc.getImgUrl(item.piclink)" alt="" />
        <div>
          <p>{{ item.title }}</p>
          <div class="fx group-price">
            <span>{{ item.group_people || "xx" }}人成团</span>
            <span v-if="item.group_face == 1">团长免单</span>
          </div>
          <div>
            <div>
              <p>
                团后价：<span><small>￥</small>{{ item.group_price || "xx" }}</span>
              </p>
              <span>马上抢</span>
            </div>
            <div>
              <p>
                原价：<span><small>￥</small>{{ item.price || "xx" }}</span>
              </p>
              <p>{{ item.real_sale || 0 }}人已经拼团成功</p>
            </div>
          </div>
        </div>
      </div>
    </div> -->
  </div>
</template>
<script>
export default {
  data () {
    return {};
  },
  props: {
    info: {
      type: Object,
      default: () => ({})
    }
  },
  components: {},
  methods: {
    get_int_dec (num, type) {
      // @type  int-整数部分 ,dec - 小数部分
      num = num + "";
      num = num.toString();
      var decimal = 2;
      decimal = decimal >= 2 && decimal < 6 ? 2 : decimal;
      decimal = decimal == "0" ? 0 : decimal || 2;
      let index = num.indexOf(".");
      if (index !== -1) {
        num = num.substring(0, decimal + index + 1);
      } else {
        num = num.substring(0);
      }
      num = parseFloat(num).toFixed(decimal);
      if (type == "int") {
        return parseInt(num);
      } else if (type == "dec") {
        return "." + num.toString().split(".")[1] || ".00";
      }
    }
  }
};
</script>
<style lang="less" scoped>
.auctionbody {
  width: 100%;
  margin: 0 auto;
  padding-bottom: 10px;
}
.auction_item {
  width: 100%;
  height: 135px;
  padding: 10px;
  margin: 0 auto 10px auto;
  background-color: #ffffff;
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-items: center;

  // border-radius: 5px;
  // border-radius: 10px;
  // overflow: hidden;
}

.auction_item_left {
  width: 120px;
  margin-right: 10px;
  img {
    width: 100%;
  }
}
.auction_item_right {
  flex: 1;

  height: 120px;
  display: flex;
  flex-flow: column;
  justify-content: space-between;
  align-items: flex-start;
  > p:nth-of-type(1) {
    font-size: 14px;
    text-align: justify;
    line-height: 20px;
    min-height: 40px;
    padding-bottom: 5px;
    color: #1a1a1a;
    font-weight: bold;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    //隐藏行数
    -webkit-line-clamp: 2;
    overflow: hidden;
  }
  > .auction_item_right_middle {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    > div {
      display: flex;
      flex-flow: column;
      justify-content: flex-start;
      align-items: flex-start;
      > p:nth-of-type(1) {
        color: #666666;
        font-size: 12px;
        line-height: 20px;
        display: flex;
        flex-wrap: nowrap;
        justify-content: flex-start;
        align-items: center;
        > span {
          font-size: 20px;
          color: #ff2043;
          font-weight: bold;
          display: flex;
          justify-content: center;

          > small {
            font-size: 12px;
            padding-top: 2px;
          }
        }
      }
      > p:nth-of-type(2) {
        color: #666666;
        font-size: 11px;
        line-height: 20px;
        display: flex;
        justify-content: center;
        align-items: center;

        > span {
          margin: 0 5px;
        }
        .van-icon {
        }
      }
    }
    > span {
      font-size: 14px;
      color: #ffffff;
      background-image: linear-gradient(to right, #ff3463, #ff7e5e);
      padding: 2px 15px;
      border-radius: 15px;
    }
  }
  > .auction_item_right_bottom {
    width: 100%;
    height: 20px;
    background-color: #f2f2f2;
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    > span:nth-of-type(1) {
      width: 75px;
      font-size: 12px;
      color: #fff;
      background-color: #ff3963;
      text-align: center;
      border-top-right-radius: 20px;
      border-bottom-right-radius: 20px;
    }
    > span:nth-of-type(2) {
      font-size: 12px;
      color: #333333;
      font-weight: bold;
    }
    .van-count-down {
      font-size: 12px;
      color: #333333;
      font-weight: bold;
    }
  }
}
</style>
